package com.utilities;






import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;

import com.google.common.collect.LinkedListMultimap;
import com.google.common.collect.Multimap;
import com.https.HttpHeader;
import com.https.UrlConstants;
import com.ui.MainWindow;
import com.utilities.TicketHelper;

/**
* @ClassName: TrainUtility
* @Description: TODO
* @author alterhu2020@gmail.com
* @date Feb 15, 2014 9:26:55 PM
* 
*/

public class TrainUtility {
	
	public static String searchTicket(String from,String to,String traindate,String strTicketType,MainWindow window) throws KeyManagementException, NoSuchAlgorithmException {
			String fromCode = TicketHelper.getCityCode(TicketHelper.convertStation(from));
			String toCode = TicketHelper.getCityCode(TicketHelper.convertStation(to));
			
			Multimap<String, String> params= LinkedListMultimap.create();
			params.put("leftTicketDTO.train_date",traindate );
			params.put("leftTicketDTO.from_station",fromCode);
			params.put("leftTicketDTO.to_station",toCode );
			params.put("purpose_codes", strTicketType);
		
		    String datas = window.client.getRequest(UrlConstants.URL_SEARCH, params, HttpHeader.tiketSearch(), window.cookies);				    
		    return datas;
		    	
		}

}
